home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Offline Browsing / HTTrack.exe / data1.cab / Sources / src / htsbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-28  |  3.8 KB  |  149 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. Please visit our Website: http://www.httrack.com
  29. */
  30.  
  31.  
  32. /* ------------------------------------------------------------ */
  33. /* File: Basic definitions                                      */
  34. /*       Used in .c files for basic (malloc() ..) definitions   */
  35. /* Author: Xavier Roche                                         */
  36. /* ------------------------------------------------------------ */
  37.  
  38. #ifndef HTS_BASICH
  39. #define HTS_BASICH
  40.  
  41. #include "htsglobal.h"
  42.  
  43. // size_t et mode_t
  44. #include <stdio.h>
  45. #if HTS_WIN
  46. #else
  47. #include <fcntl.h>
  48. #endif
  49.  
  50. #if HTS_WIN
  51. #else
  52.  #define min(a,b) ((a)>(b)?(b):(a))
  53.  #define max(a,b) ((a)>(b)?(a):(b))
  54. #endif
  55.  
  56. // teste ΘgalitΘ de 2 chars, case insensitive
  57. #define hichar(a) ((((a)>='a') && ((a)<='z')) ? ((a)-('a'-'A')) : (a))
  58. #define streql(a,b) (hichar(a)==hichar(b))
  59.  
  60. // is this MIME an hypertext MIME (text/html), html/js-style or other script/text type?
  61. #define HTS_HYPERTEXT_DEFAULT_MIME "text/html"
  62. #define is_hypertext_mime(a) \
  63.    ( (strfield2((a),"text/html")!=0)\
  64.   || (strfield2((a),"application/x-javascript")!=0) \
  65.   /*|| (strfield2((a),"audio/x-pn-realaudio")!=0) */\
  66.   )
  67.  
  68. #define may_be_hypertext_mime(a) \
  69.    (\
  70.      (strfield2((a),"audio/x-pn-realaudio")!=0) \
  71.   )
  72.  
  73.  
  74. // caractΦre maj
  75. #define isUpperLetter(a) ( ((a) >= 'A') && ((a) <= 'Z') )
  76.  
  77. // conversion Θventuelle / vers antislash
  78. #if HTS_WIN
  79. char* antislash(char* s);
  80. #else
  81. #define antislash(A) (A)
  82. #endif
  83.  
  84.  
  85. // functions
  86. #if HTS_PLATFORM!=3
  87. #ifdef __cplusplus
  88. extern "C" {
  89. #endif
  90. #if HTS_PLATFORM!=2
  91. #if HTS_PLATFORM!=1
  92.  int   open      (const char *, int, ...);
  93. #endif
  94.  //int   read      (int,const char*,int);
  95.  //int   write     (int,char*,int);
  96. #endif
  97. #if HTS_PLATFORM!=1
  98.  int   close     (int);
  99.  void* calloc    (size_t,size_t);
  100.  void* malloc    (size_t);
  101.  void* realloc   (void*,size_t);
  102.  void  free      (void*);
  103. #endif
  104. #if HTS_WIN==0
  105.  void  bzero     (char*,unsigned int);
  106.  void  bcopy     (const char*,char*,unsigned int);
  107.  //int   strcasecmp(const char*,const char*);
  108. #endif
  109.  //int   strlen    (const char *);
  110. #if HTS_WIN
  111.  //int   mkdir     (const char*);
  112. #else
  113.  int   mkdir     (const char*,mode_t);
  114.  //int   isdigit   (char);
  115.  //int   isalpha   (char);
  116.  //int   isalnum   (char);
  117. #endif
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif
  122.  
  123.  
  124. #if HTS_WIN
  125. #define  bzero(a,b) memset(a,0,b)
  126. #define  bcopy(a,b,c) memcpy(b,a,c)
  127. #endif
  128.  
  129. // tracer malloc()
  130. #if HTS_TRACE_MALLOC
  131. #define malloct(A)    hts_malloc(A,0)
  132. #define calloct(A,B)  hts_malloc(A,B)
  133. #define freet(A)      hts_free(A)
  134. #define realloct(A,B) hts_realloc(A,B)
  135. void  hts_freeall();
  136. void* hts_malloc    (size_t,size_t);
  137. void  hts_free      (void*);
  138. void* hts_realloc   (void*,size_t);
  139. #else
  140. #define malloct(A)    malloc(A)
  141. #define calloct(A,B)  calloc(A,B)
  142. #define freet(A)      free(A)
  143. #define realloct(A,B) realloc(A,B)
  144. #endif
  145.  
  146.  
  147. #endif
  148.  
  149.